<template>
  <div class="add">
    <uploader-item />
    <input
      v-model="params.title"
      class="title"
      placeholder="点击设置标题"
      type="text" />

    <textarea
      class="text"
      placeholder="分享镜头后的故事"
      maxlength="300"
      cols="30"
      rows="10"></textarea>
    <div
      class="type"
      @click="showPicker = true">
      <div class="left">
        <i class="geek-icon">&#xe620;</i>
        分类
      </div>
      <div class="right">
        <i class="geek-icon">&#xe623;</i>
      </div>
    </div>

    <!-- 上传 -->
    <van-button
      class="button"
      type="primary">
      上传
    </van-button>
  </div>
  <van-popup
    v-model:show="showPicker"
    round
    position="bottom">
    <van-picker
      :columns="columns"
      @cancel="showPicker = false"
      @confirm="onConfirm" />
  </van-popup>
</template>

<script setup lang="ts">
import { reactive, ref } from 'vue';
const showPicker = ref(false);
const params = reactive({
  title: ''
});

const columns = [
  { text: '视频', value: 'Video' },
  { text: '单图', value: 'image' },
  { text: '组图', value: 'allImage' }
];

const onConfirm = (value: any) => {
  showPicker.value = false;
};
</script>

<style lang="scss" scoped>
.add {
  padding: 20px;
  position: relative;
  min-height: 100vh;

  .title {
    margin-top: 20px;
    font-size: 42px;
    border: none;
    font-weight: bold;
  }
  .text {
    margin-top: 50px;
    width: 100%;
    border: 0;
    font-size: 30px;
  }
  .type {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    .left {
      i {
        font-size: 30px;
      }
      font-size: 30px;
      font-weight: bold;
    }
    .right {
      i {
        font-size: 24px;
        font-weight: bold;
      }
    }
  }
  .button {
    position: absolute;
    left: 50%;
    border-radius: 50px;
    transform: translateX(-50%);
    bottom: 300px;
    width: 50%;
  }
}
</style>
